package com.jyserver.common.AutoCode.jybaits.element.pc.From;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jyserver.common.utils.HelpUtils;

public class Checkbox {

    public static String getStyle(String label, Object prop, String key, JSONArray checkboxsArray) {
        String validate = "";
        if (HelpUtils.isNotEmpty(prop)) {
            prop = "prop=\"" + prop + "\"";
            validate = "v-validate=\"'required|" + prop + "'\" ";
        } else {
            prop = "";
        }
        String checkboxs = "";
        try {
            for (int i = 0; i < checkboxsArray.size(); i++) {
                JSONObject jsonObject = JSONObject.parseObject(String.valueOf(checkboxsArray.get(i)));
                checkboxs = checkboxs + "<el-checkbox  label=\"" + jsonObject.get("label") + "\" value=\"" + jsonObject.get("value") + "\" name=\"" + key + "\"></el-checkbox>\n";
            }
        } catch (Exception e) {

        }
        return "<el-form-item label=\"" + label + "\" :label-width=\"formLabelWidth\" " + prop + ">\n" +
                "<el-checkbox-group v-model=\"Dataform." + key + "\">\n" + checkboxs +
                "</el-checkbox-group>\n" +
                "</el-form-item>\n";
    }
}


